package com.fulu.springboot.helloLog;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(HelloLogProperties.class)
@ConditionalOnProperty(prefix = "hello.log", name = "enabled", havingValue = "true", matchIfMissing = true)
public class HelloLogAutoConfiguration {

    @Bean
    public HelloLog helloLog(HelloLogProperties props) {
        return new HelloLog(props.getPrefix());
    }
}